﻿using MicaSetup.Controls;
using MicaSetup.Helper;
using MicaSetup.Services;
using MicaSetup.Views;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: Guid("00000000-0000-0000-0000-000000000000")]
[assembly: AssemblyTitle("mica-packge Setup")]
[assembly: AssemblyProduct("mica-packge")]
[assembly: AssemblyDescription("mica-packge Setup")]
[assembly: AssemblyCompany("AAA")]
[assembly: AssemblyCopyright("Under MIT License. Copyright (c) Lemutec Contributors.")]
[assembly: AssemblyVersion("1.3.0.0")]
[assembly: AssemblyFileVersion("1.3.0.0")]
namespace MicaSetup;
internal class Program
{
[STAThread]
internal static void Main()
{
Hosting.CreateBuilder()
.UseLogger()
.UseSingleInstance("MicaSetup")
.UseTempPathFork()
.UseElevated()
.UseDpiAware()
.UseAsMsixInstaller(enabled: false, "c17bc862-e10e-4618-b717-e47dd2bf65c8", MsixInstallMethod.AppInstaller) // Not Impl
.UseOptions(option =>
{
option.IsCreateDesktopShortcut = true;
option.IsCreateUninst = true;
option.IsCreateStartMenu = true;
option.IsCreateQuickLaunch = false;
option.IsCreateRegistryKeys = true;
option.IsCreateAsAutoRun = false;
option.UseFolderPickerPreferClassic = false;
option.UseInstallPathPreferX86 = false;
option.IsUseRegistryPreferX86 = null!;
option.IsAllowFullFolderSecurity = true;
option.IsAllowFirewall = true;
option.IsRefreshExplorer = false;
option.IsInstallCertificate = false;
option.OverlayInstallRemoveExt = "exe,dll,pdb";
option.UnpackingPassword = null!;
option.BackdropMica = true;
option.ExeName = "mica-packge.exe";
option.KeyName = "mica-packge";
option.DisplayName = "mica-packge";
option.DisplayIcon = "mica-packge.exe";
option.DisplayVersion = "1.3.0.0";
option.Publisher = "Lemutec";
option.AppName = "mica-packge";
option.SetupName = $"mica-packge {Mui("Setup")}";
})
.UseServices(service =>
{
service.AddSingleton<IMuiLanguageService, MuiLanguageService>();
service.AddScoped<IDotNetVersionService, DotNetVersionService>();
service.AddScoped<IExplorerService, ExplorerService>();
})
.UseFonts(font =>
{
font.Add(new MuiLanguageFont().OnTwoNameOf("ja").ForSystemFont("Yu Gothic UI", "Meiryo UI"));
font.Add(new MuiLanguageFont().OnAnyName().ForResourceFont("HarmonyOS_Sans_SC_Regular.ttf", "HarmonyOS Sans SC"));
})
.CreateApp()
.UseMuiLanguage()
.UseTheme(WindowsTheme.Light)
.UsePages(page =>
{
page.Add(nameof(MainPage), typeof(MainPage));
page.Add(nameof(InstallPage), typeof(InstallPage));
page.Add(nameof(FinishPage), typeof(FinishPage));
})
.UseDispatcherUnhandledExceptionCatched()
.UseDomainUnhandledExceptionCatched()
.UseUnobservedTaskExceptionCatched()
.RunApp();
}
}
